home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Visual Basic.60 / COMMON / TOOLS / VB / OLEMSG / CLIENT.BAS < prev    next >
Encoding:
BASIC Source File  |  1996-06-15  |  1.2 KB  |  73 lines

  1. Attribute VB_Name = "client"
  2. Option Explicit
  3.  
  4.  
  5. Global objSession As Object
  6.  
  7. Type WeekDataType
  8.     Day(7) As Double
  9. End Type
  10.  
  11.  
  12.  
  13. Sub Main()
  14.  
  15. Dim bFlag As Boolean
  16.  
  17. On Error GoTo error_olemsg
  18.  
  19. 'create session and logon
  20. bFlag = Util_CreateSessionAndLogon()
  21.  
  22. If Not bFlag Then Exit Sub
  23.  
  24. 'go try to find request message and show the report form
  25. formReport.Init
  26.  
  27. If Not objSession Is Nothing Then
  28.     'logoff
  29.     objSession.Logoff
  30. End If
  31.  
  32.  
  33. Exit Sub
  34.  
  35.     
  36. error_olemsg:
  37.     If Not bFlag Then
  38.         MsgBox "Error " & Str(Err) & ": " & Error$(Err)
  39.         End
  40.     End If
  41.     
  42.  
  43. End Sub
  44.  
  45. Function Util_CreateSessionAndLogon() As Boolean
  46.     'create session and logon
  47.     On Error GoTo err_CreateSessionAndLogon
  48.  
  49.     Set objSession = CreateObject("MAPI.Session")
  50.     objSession.Logon
  51.     Util_CreateSessionAndLogon = True
  52.     Exit Function
  53.  
  54. err_CreateSessionAndLogon:
  55.     Set objSession = Nothing
  56.     
  57.     If Not (Err = -2147221229) Then  'if not user cancel
  58.         MsgBox "Unrecoverable Error:" & Err
  59.     End If
  60.     
  61.     Util_CreateSessionAndLogon = False
  62.     Exit Function
  63.     
  64. error_olemsg:
  65.     MsgBox "Error " & Str(Err) & ": " & Error$(Err)
  66.     Resume Next
  67.  
  68. End Function
  69.  
  70.  
  71.  
  72.  
  73.